import request from '@utils/ajax'

// 车品牌
export const getCarBrand = () => {
  return request({
    url: 'app/v2/carLib/brand',
    showLoading: true
  })
}

// 车系
export const getCarSeries = brand_id => {
  return request({
    url: 'app/v2/carLib/series',
    showLoading: true,
    data: {
      brand_id
    }
  })
}

// 车型
export const getCarModel = (group_id, optional_years = null) => {
  const data = {
    group_id
  }
  if (optional_years) {
    data[`optional_years[]`] = JSON.stringify([])
  }
  return request({
    url: 'app/v2/carLib/model',
    data
  })
}
